for (var a = require("../../utils/api.js"), t = getApp(), e = new Date(), o = [], n = [], s = [], i = 2010; i <= e.getFullYear(); i++) o.push(i);

for (var d = 1; d <= 12; d++) d < 10 ? n.push("0" + d) : n.push(d);

for (var l = 1; l <= 31; l++) l < 10 ? s.push("0" + l) : s.push(l);

Page({
    data: {
        years: o,
        year: e.getFullYear(),
        months: n,
        month: e.getMonth() + 1 < 10 ? "0" + (e.getMonth() + 1) : e.getMonth() + 1,
        days: s,
        day: e.getDate(),
        value: [ 9999, e.getMonth(), e.getDate() ],
        showLoding: !1
    },
    onLoad: function(e) {
        var o, n, s = this;
        a.plsugins({
            openid: t.globalData.openid,
            op: "sign",
            in: "sign_record"
        }).then(function(a) {
            console.log(a), a.data.data.length >= 10 ? (o = !1, n = 2) : (o = !0, n = 0), s.setData({
                infos: a.data.data,
                page: n,
                noMore: o,
                showLoding: !0
            });
        });
    },
    bindChange: function(a) {
        var t = a.detail.value;
        this.setData({
            year: this.data.years[t[0]],
            month: this.data.months[t[1]],
            setvalue: [ t[0], t[1], t[2] ]
        }), console.log(this.data.year, this.data.month, this.data.day);
    },
    selectdata: function() {
        this.setData({
            selectData: !0
        });
    },
    datecomfirm: function() {
        var e, o, n = this, s = n.data.year + "-" + n.data.month;
        n.setData({
            showLoding: !1
        }), console.log(s), a.plsugins({
            openid: t.globalData.openid,
            op: "sign",
            in: "sign_record",
            time: s
        }).then(function(a) {
            console.log(a), a.data.data.length >= 10 ? (e = !1, o = 2) : (e = !0, o = 0), n.setData({
                infos: a.data.data,
                page: o,
                noMore: e,
                showLoding: !0
            });
        }), n.setData({
            selectData: !1,
            value: n.data.setvalue
        });
    },
    cancel: function() {
        this.setData({
            selectData: !1
        });
    },
    onReachBottom: function() {
        var e, o, n = this, s = n.data.page, i = n.data.infos;
        if (console.log(s), "" == s || void 0 == s || null == s || 0 == s) return !1;
        a.plsugins({
            openid: t.globalData.openid,
            op: "sign",
            in: "sign_record",
            page: s
        }).then(function(a) {
            console.log(a);
            for (var t in a.data.data) i.push(a.data.data[t]);
            a.data.data.length < 10 ? (e = 0, o = !0) : (e = s + 1, o = !1), n.setData({
                infos: i,
                page: e,
                noMore: o
            });
        });
    }
});